<?php

// application/models/project.php

class Application_Model_Project {

    protected $name;
    protected $id;
    protected $svn_url;
    protected $code;
    protected $user_id;
    protected $host_ip;
    protected $host_acc;
    protected $host_pass;
    protected $db_acc;
    protected $db_pass;
    protected $active;

    public function __construct(array $options = null) {
        if (is_array($options)) {
            $this->setOptions($options);
        }
    }

    public function __set($name, $value) {
        $method = 'set' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid content property');
        }
        $this->$method($value);
    }

    public function __get($name) {

        $method = 'get' . $name;

        if (('mapper' == $name) || !method_exists($this, $method)) {

            throw new Exception('Invalid content property');
        }

        return $this->$method();
    }

    public function setOptions(array $options) {

        $methods = get_class_methods($this);

        foreach ($options as $key => $value) {

            $method = 'set' . ucfirst($key);

            if (in_array($method, $methods)) {

                $this->$method($value);
            }
        }
        return $this;
    }

    /**
     * @return unknown
     */
    public function getActive() {
        return $this->active;
    }

    /**
     * @return unknown
     */
    public function getCode() {
        return $this->code;
    }

    /**
     * @return unknown
     */
    public function getDb_acc() {
        return $this->db_acc;
    }

    /**
     * @return unknown
     */
    public function getDb_pass() {
        return $this->db_pass;
    }

    /**
     * @return unknown
     */
    public function getHost_acc() {
        return $this->host_acc;
    }

    /**
     * @return unknown
     */
    public function getHost_ip() {
        return $this->host_ip;
    }

    /**
     * @return unknown
     */
    public function getHost_pass() {
        return $this->host_pass;
    }

    /**
     * @return unknown
     */
    public function getId() {
        return $this->id;
    }

    /**
     * @return unknown
     */
    public function getName() {
        return $this->name;
    }

    /**
     * @return unknown
     */
    public function getSvn_url() {
        return $this->svn_url;
    }

    /**
     * @return unknown
     */
    public function getUser_id() {
        return $this->user_id;
    }

    /**
     * @param unknown_type $active
     */
    public function setActive($active) {
        $this->active = $active;
        return $this;
    }

    /**
     * @param unknown_type $code
     */
    public function setCode($code) {
        $this->code = $code;
        return $this;
    }

    /**
     * @param unknown_type $db_acc
     */
    public function setDb_acc($db_acc) {
        $this->db_acc = $db_acc;
        return $this;
    }

    /**
     * @param unknown_type $db_pass
     */
    public function setDb_pass($db_pass) {
        $this->db_pass = $db_pass;
        return $this;
    }

    /**
     * @param unknown_type $host_acc
     */
    public function setHost_acc($host_acc) {
        $this->host_acc = $host_acc;
        return $this;
    }

    /**
     * @param unknown_type $host_ip
     */
    public function setHost_ip($host_ip) {
        $this->host_ip = $host_ip;
        return $this;
    }

    /**
     * @param unknown_type $host_pass
     */
    public function setHost_pass($host_pass) {
        $this->host_pass = $host_pass;
        return $this;
    }

    /**
     * @param unknown_type $id
     */
    public function setId($id) {
        $this->id = (int)$id;
        return $this;
    }

    /**
     * @param unknown_type $name
     */
    public function setName($name) {
        $this->name = $name;
        return $this;
    }

    /**
     * @param unknown_type $svn_url
     */
    public function setSvn_url($svn_url) {
        $this->svn_url = $svn_url;
        return $this;
    }

    /**
     * @param unknown_type $user_id
     */
    public function setUser_id($user_id) {
        $this->user_id = $user_id;
        return $this;
    }

}